<?php

class Application_Model_Kurier
{
    protected $_id_kur;
    protected $_miasto;

        public function __construct(array $options = null)
    	{
        	if (is_array($options))
        	{
            		$this->setOptions($options);
        	}
    	}

   	public function __set($name, $value)
    	{
    		$metoda = 'set'.ucfirst($name);

    		if(('mapper' == $name) || !method_exists($this, $metoda))
    		{
    			throw new exception('Nie ma takiej właściwośći!');
    		}

    		$this->$metoda($value);
    	}

    	public function __get($name)
    	{
    		$metoda = 'get'.ucfirst($name);

    		if(('mapper' == $name) || !method_exists($this, $metoda))
    		{
    			throw new exception('Nie ma takiej właściwośći!');
    		}

    		$this->$metoda();
    	}

    	public function setOptions(array $options)
    	{
        	$methods = get_class_methods($this);

        	foreach ($options as $key => $value)
        	{
        		$method = 'set' . ucfirst($key);
        		if (in_array($method, $methods))
        		{
        			$this->$method($value);
            		}
        	}
        	return $this;
    	}

    	public function setIdKur($id)
    	{
    		$this->_id_kur = (int)$id;
    		return $this;
    	}
    	public function getIdKur()
    	{
    		return $this->_id_kur;
    	}

        public function setMiasto($miasto)
    	{
    		$this->_miasto = (int)$miasto;
    		return $this;
    	}
    	public function getMiasto()
    	{
    		return $this->_miasto;
    	}

        

}

